package com.yxq.mdt.app.modules.socialcontact.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.modules.socialcontact.bean.NearManAndDynamicTopicBean;
import com.yxq.mdt.app.modules.socialcontact.bean.PerfectBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SelectNearbyListBean;
import com.yxq.mdt.app.modules.socialcontact.model.MainSocialContactModel;
import com.yxq.mdt.app.net.ApiModel;

public class MainSocialNearPresenter extends BasePresenter<MainSocialNearContract.View, MainSocialContactModel> implements MainSocialNearContract.Presenter {
    /**
     * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
     *
     * @param rootView
     * @param model
     */
    public MainSocialNearPresenter(MainSocialNearContract.View rootView, MainSocialContactModel model) {
        super(rootView, model);
    }


    @Override
    public void getNearManAndDynamic(String mapLng, String mapLat) {
        mBaseModel.getNearManAndDynamic(mapLng, mapLat, new ApiModel.CommonCallback<String>() {
            @Override
            public void onSuccess(String s) {
                mRootView.onLoadNearManAndDynamicSuccess(s);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadNearManAndDynamicFailed();
            }
        });
    }

    @Override
    public void getQueryIsPerfect() {
        mBaseModel.getQueryIsPerfect(new ApiModel.CommonCallback<PerfectBean>() {
            @Override
            public void onSuccess(PerfectBean s) {
                mRootView.onLoadQueryIsPerfectSuccess(s);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadQueryIsPerfectFailed();
            }
        });
    }

    @Override
    public void getNearManAndDynamicTopic(String mapLng, String mapLat, int pageNum, int pageSize) {
        mBaseModel.getNearManAndDynamicTopic(mapLng, mapLat, pageNum, pageSize, new ApiModel.CommonCallback<NearManAndDynamicTopicBean>() {
            @Override
            public void onSuccess(NearManAndDynamicTopicBean mainSocialContactRecommendBean) {
                mRootView.onLoadNearManAndDynamicTopicSuccess(mainSocialContactRecommendBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadNearManAndDynamicTopicFailed();
            }
        });
    }

    @Override
    public void getSelectMyNearby(int pageNum, int pageSize, String lng, String lat,String sex) {
        mBaseModel.getSelectMyNearby(pageNum, pageSize, lng, lat,sex, new ApiModel.CommonCallback<SelectNearbyListBean>() {
            @Override
            public void onSuccess(SelectNearbyListBean selectNearbyListBean) {
                mRootView.onLoadSelectMyNearbySuccess(selectNearbyListBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadSelectMyNearbyFailed();
            }
        });
    }


}
